<div class="main-content">
	<div class="breadcrumbs" id="breadcrumbs">
		<script type="text/javascript">
			try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
		</script>

		<ul class="breadcrumb">
			<li class="active">
				<i class="icon-home home-icon"></i>
				<a href="#">系统首页</a>
			</li>
			<li>
				<a href="#">系统管理</a>
			</li>
			<li class="active">数据字典</li>
		</ul><!-- .breadcrumb -->
	</div>

	<div class="page-content">
		<div class="page-header">
			<h1>数据字典信息表</h1>
		</div>
		<div class="row">
		    <div class="col-xs-2">
			     <div class="widget-box">
			         <div class="widget-header">
			             <h4 class="smaller">数据字典</h4>
			         </div>
			         <div class="widget-body dropdown dropdown-preview">
						<ul class="dropdown-menu">
							<?php if (isset($dictionary)&&count($dictionary)>0){
								foreach ($dictionary as $val){ ?>
								<li <?php if ($val->id == $id){?>class="active"<?php }?>>
									<a href="<?php echo base_url().'admin/systems/query_data?id='.$val->id;?>" >
									<?php echo $val->name;?>
									</a>
   								</li>
								<?php }
							}?>
						</ul>
			         </div>
			     </div>
			</div>
			<div class="col-xs-10">
    			  <h3><?php if (isset($dictionary)&&count($dictionary)>0){
		                      foreach ($dictionary as $val){ 
		                          if($val->id == $id){
		                              echo $val->name;
		                          }
		                      }
                        }?></h3>
				<!-- PAGE CONTENT BEGINS -->
				<a href="<?php echo base_url().'admin/systems/add_dictionary_data';?>" class="btn btn-info btn-sm"><i class="icon-copy"></i>新增</a>
				<a href="javascript:void(0)" onclick="delSomeModal()" data-toggle="modal" class="btn btn-danger btn-sm"><i class="icon-trash"></i>删除</a>
				<br><br>
				<div class="table-responsive">
	                <input type="hidden" name="id" id="id" value="<?php echo $id;?>"/>
	                <form action="<?php echo base_url().'admin/systems/del_some_data/'.$id;?>" method="post" id="delForm">
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                            	<th class="center" style="width: 3%">
	                            	<label>
										<input type="checkbox" class="ace" />
										<span class="lbl"></span>
									</label>
                            	</th>
                            	<th>项目名称</th>
                                <th>项目值</th>
                                <th>备注</th>
                                <th style="width: 15%;">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if (isset($result)&&count($result)>0){
                            	foreach ($result as $data){
                            	?>
                            <tr>
                            	<td class="center">
                            		<label>
										<input type="checkbox" class="ace" name="num[]" value="<?php echo $data->id;?>"/>
										<span class="lbl"></span>
									</label>
                            	</td>
                            	<td><?php echo $data->name;?></td>
                            	<td><?php echo $data->value;?></td>
                            	<td><?php echo $data->note;?></td>
                            	<td>
	                            	<a href="<?php echo base_url().'admin/systems/edit_dictionary_data/'.$data->id;?>" class="btn btn-info btn-sm"><i class="icon-edit"></i>修改</a>
	                            	<a href="javascript:void(0)" onclick="delmodal('<?php echo $data->id;?>')" data-toggle="modal" class="btn btn-danger btn-sm"><i class="icon-trash"></i>删除</a>
                            	</td>
                            </tr>
                            <?php }
                            }else{?>
                            <tr>
                            	<td colspan="6">无数据</td>
                            </tr>
                            <?php }?>
                            </tbody>
                         </table>
                     </form>
                </div><!-- /.table-responsive -->
                <div class="modal-footer no-margin-top">
	                	<div class="pull-left record">
							共<?php echo $count;?>条记录
	                    </div>
                		<?php if (isset($page))echo $page;?>
                	</div>
			</div><!-- PAGE CONTENT ENDS -->
		</div><!-- /.row -->
	</div><!-- /.page-content -->
</div><!-- /.main-content -->
<div id="delModal" class="modal fade" role="dialog" aria-hidden="true">
	<div class="modal-dialog" style="width: 300px">
		<div class="modal-content">
			<div class="modal-header">
			  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			  <h3>提示信息</h3>
			</div>
			<div class="modal-body">
			  <p>确定要删除此项目吗？</p>
			</div>
			<div class="modal-footer">
			  <a id="delbtn" href="#" class="btn btn-danger">确定</a>
			  <a href="#" class="btn btn-info" data-dismiss="modal" aria-hidden="true">取消</a>
			</div>
		</div>
	</div>
</div>
<div id="delsomeModal" class="modal fade" role="dialog" aria-hidden="true">
	<div class="modal-dialog" style="width: 300px">
		<div class="modal-content">
			<div class="modal-header">
			  <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
			  <h3>提示信息</h3>
			</div>
			<div class="modal-body">
			  <p>确定要删除所选项目吗？</p>
			</div>
			<div class="modal-footer">
			  <button id="delsomebtn" type="submit" class="btn btn-danger">确定</button>
			  <a href="#" class="btn btn-info" data-dismiss="modal" aria-hidden="true">取消</a>
			</div>
		</div>
	</div>
</div>
<style>
.dropdown-preview{
	display: inline-block;
	width: 100%;
}
.dropdown-preview  > .dropdown-menu {
	display: block;
	position: static;
	width:100%;
	border: 0px;
	margin:0px;
	padding:0px;
	min-width: inherit;
}
.dropdown-menu li{
	border-top: 1px solid #ccc;
}
</style>
<script>
function delmodal(id){
	$("#delbtn").attr('href','<?php echo base_url().'admin/systems/del_data/'.$id.'/'?>'+id);
	    $('#delModal').modal('show');
	}
function delSomeModal(){
	if(checkSelect()){
    	$('#delsomeModal').modal('show');
	}else{
		alert('请选择正确的记录进行删除');
	}
}
$("#delsomebtn").click(function(){
	$("#delForm").submit();
});
</script>